<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
        <script src="js/time.js?"></script>
    </head>
    <body>
        <?php include(VIEWPATH . 'common/main_header.php'); ?>
        <?php
        	//print_r($row); 
        ?>
        <form action="" method="POST" id="rowForm">
            <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tablegrid tableedit">
                <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_BOX_ID') ?></td>
                    <td>
                    	<?=$boxtype[$row['box_id']] ?>
                    	<!--  
                    	<select name="row[box_id]" id="box_id">
						<?php  foreach ($boxtype as $key => $value) { ?>
							<option value="<?=$key ?>"><?=$value ?></option>
						<?php } ?>
						</select>
						-->
                    </td>
                </tr>
                <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_CHOICE_TYPE') ?></td>
                    <td>
                    	<?=$numbertype[$row['choice_type']] ?>
                    	<!--
                    	<select name="row[choice_type]" id="choice_type">
						<?php  foreach ($numbertype as $key => $value) { ?>
							<option value="<?=$key ?>"><?=$value ?></option>
						<?php } ?>
						</select>
						-->
                    </td>
                </tr>
                
                <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_MATERIAL_TYPE') ?></td>
                    <td>
                    	<?=$materialtype[$row['material_type']] ?>
                    	<!--
                    	<select name="row[material_type]" id="material_type" onChange="showobject()">
                    	<option value="-1"><?= translate('PLASE_SELECT') ?></option>
						<?php  foreach ($materialtype as $key => $value) { ?>
							<option value="<?=$key ?>"><?=$value ?></option>
						<?php } ?>
						</select>
						-->
                    </td>
                </tr>
                <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_OBJECT_NAME') ?></td>
                    <td>
                    	<?=$objecttype[$row['material_type']][$row['object_id']]['name'] ?>
                    	<!--
                    	<select name="row[object_id]" id="object_id" onChange="showoprofession">
                    	<option value="-1"><?= translate('PLASE_SELECT') ?></option>
						</select>
						-->
                    </td>
                </tr>
                
                <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_PROFESSION') ?></td>
                    <td>
                    	<?=$professiontype[$row['profession']] ?>
                    	<!-- 
                    	<select name="row[profession]" id="profession">
						<?php  foreach ($professiontype as $key => $value) { ?>
							<option value="<?=$key ?>" <?php if($key == $row['profession']) echo 'selected'; ?> ><?=$value ?></option>
						<?php } ?>
						</select>
					 	 -->
                    </td>
                </tr>
                <input type='hidden' value='<?=$row['isforever'] ?>' name='row[isforever]'>
                <input type='hidden' value='<?=$row['id'] ?>' name='row[id]'>
                <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_ISFOREVER') ?></td>
                    <td>
                    	<?php if(0 === $row['isforever']) { ?>
                    		<?= translate('YES') ?>
                    	<?php }else{ ?>
                    		<?= translate('NO') ?>
                    	<?php } ?>
                    	<!--  
                    	<select name="row[box_id]" id="box_id">
						<?php  foreach ($boxtype as $key => $value) { ?>
							<option value="<?=$key ?>"><?=$value ?></option>
						<?php } ?>
						</select>
						-->
                    </td>
                </tr>
                 
                <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_RATION') ?></td>
                    <td>
                    	<input type="text" name="row[ration]" id="ration" size="25" value="<?=$row['ration'] ?>"/>
                    </td>
                </tr>
                
                <div id = 'arrangetime' style="display: none">
                <tr><td><?= translate('STARTTIME') ?>:</td><td>
                	<input type="text" name="row[starttime]" id="starttime" value="<?=date('Y-m-d H:i:s',$row['starttime']) ?>" 
                		size="25" onClick="SelectDate(this,'yyyy-MM-dd hh:mm:ss',0,10)"/>
                </td></tr>
                <tr><td><?= translate('ENDTIME') ?>:</td><td>
                	<input type="text" name="row[endtime]" id="endtime" value="<?=date('Y-m-d H:i:s',$row['endtime']) ?>" 
                		size="25" onClick="SelectDate(this,'yyyy-MM-dd hh:mm:ss',0,10)"/>
                </td></tr>
                </div>
                
                <?php if(0 === $row['isforever'] ) { ?>
                	<script type="text/javascript">
                		//$('#arrangetime').hide();
                		alert('hello');
                		$('#arrangetime').show();
                	</script>
                <?php }?>
                <tr>
                    <td></td>
                    <td><input type="submit" value="<?= translate('SUBMIT') ?>" id="submit" /> <input type="reset" value="<?= translate('RESET') ?>" id="reset" /></td>
                </tr>
            </table>
        </form>
        <script type="text/javascript">
            SG.init("core.form", function() {
                $.formValidator.initConfig({formid: "#rowForm", submitonce: true});
                $("#starttime").formValidator({empty: false, onshow: '<?= translate('C_ONLY_NUM') ?>'}).regexValidator({regexp: "^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\\s((([0-1][0-9])|(2?[0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))))?$", onerror: '<?= translate('C_INVALID_TIME') ?>'});
                $("#endtime").formValidator({empty: false, onshow: '<?= translate('C_NOT_EMPTY') ?>'}).regexValidator({regexp: "^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\\s((([0-1][0-9])|(2?[0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))))?$", onerror: '<?= translate('C_INVALID_TIME') ?>'});
                $("#ration").formValidator({empty: false, onshow: '<?= translate('C_NOT_EMPTY') ?>'}).regexValidator({regexp: 'num', datatype: 'enum', onerror: '<?= translate('C_ONLY_NUM') ?>'});
                
                 });
        </script>
    </body>
</html>